package kr.co.boogui.helper;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import kr.co.boogui.dao.ReservationDAO;
import kr.co.boogui.model.MovieVO;


@WebServlet("/get_cinename.bi")
public class GetCinemaName extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	protected void doGet(HttpServletRequest req, HttpServletResponse res) 
			throws ServletException, IOException {
		res.setContentType("text/html; charset=UTF-8");
		PrintWriter out = res.getWriter();
		String movno = req.getParameter("movno");
		MovieVO m = ReservationDAO.movieTitle(movno);
		String title = m.getTitle();
		String rate = m.getRate();
		String html = 
				"<div id='poster'>"
					+ "<img src='image.bi?id=poster/small/"+movno+".jpg'>"
				+ "</div>"
				+ "<div id='movinfo'>"
					+ "<div id='title_rating'>"
						+ "<img src='images/rate/"+rate+".png' width='40px' /><br /> <h1>"+title+"</h1>"
					+ "</div>"
				+ "</div>";
		out.print(html);
		
		out.close();
	}
}
